package com.yfbao.horizon.model;

import com.fasterxml.jackson.databind.JsonMappingException;

import java.io.Serializable;

public abstract class BaseResponse implements Serializable {
    private static final long serialVersionUID = 7849116577617831908L;
    private int status;
    private String code;
    private String message;

    public BaseResponse() {
        this.status = 0;
        this.code = "BOOT_0000";
        this.message = "SUCCESS";
    }

    public boolean success() {
        return this.status == 0;
    }

    public boolean failure() {
        return this.status == 2;
    }

    public boolean processing() {
        return this.status == -1;
    }

    public String toString() {
        return "ToStringUtils.toString(this)";
    }

    public static BaseResponse buildResponse(Exception e) {
        BaseResponse response = new SingleResponse();
        return response;
    }

    public int getStatus() {
        return this.status;
    }

    public String getCode() {
        return this.code;
    }

    public String getMessage() {
        return this.message;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public BaseResponse(int status, String code, String message) {
        this.status = status;
        this.code = code;
        this.message = message;
    }
}